#include <iostream>
#include <string>
#include <fstream>
#include <iostream>
#include <vector>
#include <math.h>
#include <omp.h>
#include <CL/cl.hpp>
#include <time.h>
#include <windows.h>
#include <Winreg.h>
#include <Strsafe.h>
#include <stdio.h>

#define MAX_KEY_LENGTH 255

typedef int (WINAPI * CLGETPLATFORMIDS)(cl_uint, cl_platform_id *,cl_uint *);
typedef int (WINAPI * CLGETPLATFORMINFO)(cl_platform_id, cl_platform_info,size_t,void *,size_t *);
typedef int (WINAPI * CLGETDEVICEINFO)(cl_device_id,cl_device_info,size_t,void *,size_t *);
typedef int (WINAPI * CLGETDEVICEIDS)(cl_platform_id,cl_device_type,cl_uint,cl_device_id *,cl_uint *);

using namespace std;

HINSTANCE							hDll;
CLGETPLATFORMIDS					pClGetPlatformIDs;
CLGETPLATFORMINFO					pClGetPlatformInfo;
CLGETDEVICEINFO						pClGetDeviceInfo;
CLGETDEVICEIDS						pClGetDeviceIDs; 


struct GRAPHIC_ADAPTER 
{
	string							name;
	string							driverVersion;
};


cl_uint								numPlatforms;
cl_platform_id						platform = NULL;
cl_platform_id	*					platforms;
cl_int								status;
cl_device_id  *						devices;
cl_uint								numDevices; 


struct DEVICE_INFO
{
	cl_device_type					cl_device_type;
	cl_uint							cl_device_vendor_id;
	cl_uint							cl_device_max_compute_units;
	cl_uint							cl_device_max_work_item_dimensions;
	size_t							cl_device_max_work_item_sizes[3];
	size_t							cl_device_max_work_group_size;
	cl_uint							cl_device_preferred_vector_width_char;
	cl_uint							cl_device_preferred_vector_width_short;
	cl_uint							cl_device_preferred_vector_width_int;
	cl_uint							cl_device_preferred_vector_width_long;
	cl_uint							cl_device_preferred_vector_width_float;
	cl_uint							cl_device_preferred_vector_width_double;
	cl_uint							cl_device_max_clock_frequency;
	cl_uint							cl_device_address_bits;
	cl_ulong						cl_device_max_mem_alloc_size;
	cl_bool							cl_device_image_support;
	cl_uint							cl_device_max_read_image_args;
	cl_uint							cl_device_max_write_image_args;
	size_t							cl_device_image2d_max_width;
	size_t							cl_device_image2d_max_height;
	size_t							cl_device_image3d_max_width;
	size_t							cl_device_image3d_max_height;
	size_t							cl_device_image3d_max_depth;
	cl_uint							cl_device_max_samplers;
	size_t							cl_device_max_parameter_size;
	cl_uint							cl_device_mem_base_addr_align;
	cl_uint							cl_device_min_data_type_align_size;
	cl_device_fp_config				cl_device_single_fp_config;
	cl_uint							cl_device_global_mem_cacheline_size;
	size_t							cl_device_profiling_timer_resolution;
	cl_device_mem_cache_type		cl_device_global_mem_cache_type;
	cl_ulong						cl_device_global_mem_cache_size;
	cl_ulong						cl_device_global_mem_size;
	cl_ulong						cl_device_max_constant_buffer_size;
	cl_uint							cl_device_max_constant_args;
	cl_device_local_mem_type		cl_device_local_mem_type;
	cl_ulong						cl_device_local_mem_size;
	cl_bool							cl_device_error_correction_support;
	cl_bool							cl_device_endian_little;
	cl_bool							cl_device_available;
	cl_bool							cl_device_compiler_available;
	cl_device_exec_capabilities		cl_device_execution_capabilities;
	cl_command_queue_properties		cl_device_queue_properties;
	cl_platform_id					cl_device_platform;
	char							cl_device_name[1024];
	char							cl_device_vendor[1024];
	char							cl_driver_version[1024];
	char							cl_device_profile[1024];
	char							cl_device_version[1024];
	char							cl_device_extensions[1024];	
};

